package test.test6_18;

import java.util.Scanner;

public class Demo14 {
    //需求：比较两个数据是否相等
    //参数类型分别为两个int 两个double 并进行测试

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a, b;
        System.out.println("请输入两个整数：");
        a = sc.nextInt();
        b = sc.nextInt();
        if (isEquals(a, b)) {
            System.out.println("相等");
        }else {
            System.out.println("不相等");
        }
        System.out.println("----------------------");
        System.out.println("请输入两个小数：");
        double c,d;
        c = sc.nextDouble();
        d = sc.nextDouble();
        if(isEquals(c,d)) {
            System.out.println("相等");
        }else {
            System.out.println("不相等");
        }

    }

    public static boolean isEquals(int a, int b) {
        return a == b;
    }

    public static boolean isEquals(double a, double b) {
        return a == b;
    }
}
